import Vue from 'vue'
import Vuex from 'vuex'
Vue.use(Vuex)

const store = new Vuex.Store({
	height:0,
	screenHeight: "",
	screenWidth: "",
	state: {
		tabbarIndex: 0,
		token: "eyJhbGciOiJodHRwOi8vd3d3LnczLm9yZy8yMDAxLzA0L3htbGRzaWctbW9yZSNobWFjLXNoYTI1NiIsInR5cCI6IkpXVCJ9.eyJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXR5L2NsYWltcy9uYW1laWRlbnRpZmllciI6IjdmMTNhNjkwLTZjYWQtNDk1Mi00MTNkLTA4ZGIxYmQzMzFiZCIsImh0dHA6Ly9zY2hlbWFzLm1pY3Jvc29mdC5jb20vd3MvMjAwOC8wNi9pZGVudGl0eS9jbGFpbXMvcm9sZSI6InVzZXIiLCJleHAiOjE2ODAzNTQyMjksImlzcyI6IlRDX1NvZnQiLCJhdWQiOiJTdHVkZW50In0.EcVpcMUCZvKFLy-_QnvkoCEnpAqKxFMNXuDL5DpGf7M",
		userInfo: {
			id: "9f382414-e06b-4c07-3dcb-08dab7b8b30a",
			nickName: "FFC_ruanjian",
			avatarUrl:""
		},
		role: 0
	},
})
//获取屏幕高度
uni.getSystemInfo({
	success: (res) => {
		// console.log(res.screenHeight); //屏幕高度  注意这里获得的高度宽度都是px 需要转换rpx
		// console.log(res.windowWidth); //可使用窗口宽度
		console.log(res.windowHeight); //可使用窗口高度
		// console.log(res.screenWidth); //屏幕宽度
		var rpx = (res.screenHeight * (750 / res.windowWidth))
		store.screenHeight = rpx + "rpx"
		store.height = parseInt(rpx)
		// store.screenHeight = res.windowHeight + "px"
		store.screenWidth = res.screenWidth + "px"
	}
})

// this.$nextTick(function() {
// 	uni.getSystemInfo({
// 		success: res => {
// 			console.log(res.safeArea.height);
// 		}
// 	});
// });


export default store
